package com.ayi.servlet.backstage; /**
 * @author Ayingzz
 * @create 2021/12/2 16:28
 */

import com.ayi.dao.bookdao.QueryBook;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

@WebServlet(name = "detailsShowBackStageServlet", value = "/detailsShowBackStageServlet")
public class detailsShowBackStageServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        int id = Integer.parseInt(request.getParameter("id"));
        Map<Integer, Integer> detailsShowMap = (Map) request.getSession().getAttribute("detailsShowMap");
        if (detailsShowMap.get(1) != id) {
            detailsShowMap.put(1, id);
        } else {
            detailsShowMap.put(1, -999);
        }
        request.getSession().setAttribute("detailsShowMap", detailsShowMap);
        request.getRequestDispatcher("backStage.jsp").forward(request, response);
    }
}
